### Project 1 Line Tracking Sensor ![](media/wps4.png) **1.Introduction** This Line Tracking Sensor can detect white lines in black and black lines in white. The single line-tracking signal provides a stable output signal TTL for a more accurate and more stable line. Multi-channel option can be easily achieved by installing required line-tracking robot sensors. **2.Specification** - Power Supply: +5V - Operating Current: <10mA - Operating Temperature Range: 0°C ~ + 50°C - Output Interface: 3-wire interface (1 - signal, 2 - power, 3 - power supply negative) - Output Level: TTL level **3.Connection Diagram** ![](media/wps5.jpg) **4.Sample Code** ```c const int sensorPin = 3; // the number of the sensor pin const int ledPin = 13; // the number of the LED pin int sensorState = 0; // variable for reading the sensor status void setup() { pinMode(ledPin, OUTPUT); pinMode(sensorPin, INPUT); } void loop() { // read the state of the sensor value: sensorState = digitalRead(sensorPin); // if the sensorState is HIGH: if (sensorState == HIGH) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } } ``` **5.Result** After power-on, power indicator D1 is on. When you block the sensing part of line tracking sensor with black paper, LED on the sensor is off as shown in Figure 1. When you block it with white paper, LED is on as shown in Figure 2. Figure 1: ![](media/wps6.png) Figure 2: ![](media/wps7.png)